<template>
  <div>
      {{n}}
      <button @click="btn">点击随机取出一个名字在页面显示</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      arr: ['小花', '小明', '小可爱', '小王'],
      n: ''

    }
  },
  methods: {
    btn () {
      this.n = this.arr[(Math.floor(Math.random() * this.arr.length + 1) - 1)]
    }
  }
}
</script>

<style>

</style>
